﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Kata.RomanNumerals.Tests
{
    [TestClass]
    public class RomanNumeralsTest
    {
        [TestMethod]
        public void ConvertNumbersToSingleSymbolRomanNumerals()
        {
            Assert.AreEqual("I", 1.ToRomanNumerals());
            Assert.AreEqual("V", 5.ToRomanNumerals());
            Assert.AreEqual("X", 10.ToRomanNumerals());
            Assert.AreEqual("L", 50.ToRomanNumerals());
            Assert.AreEqual("C", 100.ToRomanNumerals());
            Assert.AreEqual("D", 500.ToRomanNumerals());
            Assert.AreEqual("M", 1000.ToRomanNumerals());
        }

        [TestMethod]
        public void ConvertNumbersWhereASmallValueIsSubtractedFromALargeValue()
        {
            Assert.AreEqual("IV", 4.ToRomanNumerals());
            Assert.AreEqual("IX", 9.ToRomanNumerals());
            Assert.AreEqual("XL", 40.ToRomanNumerals());
            Assert.AreEqual("XC", 90.ToRomanNumerals());
            Assert.AreEqual("CD", 400.ToRomanNumerals());
            Assert.AreEqual("CM", 900.ToRomanNumerals());
        }

        [TestMethod]
        public void ConvertMoreComplexNumbers()
        {
            Assert.AreEqual("XLIX", 49.ToRomanNumerals());
            Assert.AreEqual("CDXCIX", 499.ToRomanNumerals());
            Assert.AreEqual("XCIX", 99.ToRomanNumerals());
            Assert.AreEqual("MCMIII", 1903.ToRomanNumerals());
            Assert.AreEqual("MCMXCIX", 1999.ToRomanNumerals());
        }

        [TestMethod]
        public void ConvertRomanNumeralsToIntegers()
        {
            Assert.AreEqual(1, RomanNumerals.ToInteger("I"));
            Assert.AreEqual(5, RomanNumerals.ToInteger("V"));
            Assert.AreEqual(10, RomanNumerals.ToInteger("X"));
            Assert.AreEqual(50, RomanNumerals.ToInteger("L"));
            Assert.AreEqual(100, RomanNumerals.ToInteger("C"));
            Assert.AreEqual(500, RomanNumerals.ToInteger("D"));
            Assert.AreEqual(1000, RomanNumerals.ToInteger("M"));

            Assert.AreEqual(4, RomanNumerals.ToInteger("IV"));
            Assert.AreEqual(9, RomanNumerals.ToInteger("IX"));
            Assert.AreEqual(40, RomanNumerals.ToInteger("XL"));
            Assert.AreEqual(90, RomanNumerals.ToInteger("XC"));
            Assert.AreEqual(400, RomanNumerals.ToInteger("CD"));
            Assert.AreEqual(900, RomanNumerals.ToInteger("CM"));

            Assert.AreEqual(49, RomanNumerals.ToInteger("XLIX"));
            Assert.AreEqual(499, RomanNumerals.ToInteger("CDXCIX"));
            Assert.AreEqual(99, RomanNumerals.ToInteger("XCIX"));
            Assert.AreEqual(1903, RomanNumerals.ToInteger("MCMIII"));
            Assert.AreEqual(1999, RomanNumerals.ToInteger("MCMXCIX"));
        }
    }
}